<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
%>
<div class="center_right">
        
        <div class="software_box"><img src="<%=path %>/content/images/3dbox.gif" alt="" title="" /></div>
        			
                        <div class="text_box">
                        	 <c:choose>
           					 <c:when test="${user == null}">
	                        	<form action="<%=path %>/user/loginUser" method="post">
	                        		<div class="title">用户登陆</div>
		                            <div class="login_form_row">
		                            <label class="login_label">Username:</label><input type="text" name="username" class="login_input" />
		                            </div>
		                            <div class="login_form_row">
		                            <label class="login_label">Password:</label><input type="password" name="password" class="login_input" />
		                            </div>          
		                            <a class="login" href="<%=path %>/user/goAddUser" >注册新用户</a>                           
		                            <input type="image" src="<%=path %>/content/images/login.gif" class="login" />      
	                            </form>                        
                 			 </c:when>
		                     <c:otherwise>
		                     	${user.name}登陆成功,<a href="<%=path %>/user/logoutUser">注销登陆</a><br/>
		                     	<a href="<%=path %>/goods/listGoods">全部物品</a><br/>
		                     	<a href="<%=path %>/goods/listmeGoods">我的物品</a><br/>
		                     	<a href="<%=path %>/goods/goAddGoods">添加物品</a><br/>
		                     	<a href="<%=path %>/user/goModifyUser">修改密码</a><br/>
		                     </c:otherwise>
		                     </c:choose>
	                     </div>
                        <div class="testimonials">
                        	<div class="title">热门物品</div>
                            <div class="text_box">
                             <p class="testimonial">
                             	<c:choose>
									<c:when test="${goodshot != null}">
										<table class="table_sidebar">
												<tr>
													<td>商品名</td>
													<td>拥有者</td>
													<td>时间</td>
												</tr>
											<c:forEach items="${goodshot}" var="goodshot">
												<tr>
													<td><a onclick="ajaxload(this);return false;" href="<%=path%>/goods/viewGoods?id=${goodshot.id }">${goodshot.name}</a></td>
													<td>${goodshot.owner.name }</td>
													<td><fmt:formatDate value="${goodshot.airTime}" pattern="yyyy-MM-dd" /></td>
												</tr>
											</c:forEach>
										</table>
									</c:when>
									<c:otherwise>
										&nbsp;&nbsp;暂无热门货品
									</c:otherwise>
								</c:choose>
                             
                             </p>
                            
                            
                            </div>                    
                        
                        </div>
                        
                        <div class="testimonials">
                        	<div class="title">最新物品</div>
                            <div class="text_box">
                             <p class="testimonial">
                             	<c:choose>
									<c:when test="${goodsnew != null}">
										<table class="table_sidebar">
												<tr>
													<td>商品名</td>
													<td>拥有者</td>
													<td>时间</td>
												</tr>
											<c:forEach items="${goodsnew}" var="goodsnew">
												<tr>
													<td><a onclick="ajaxload(this);return false;" href="<%=path%>/goods/viewGoods?id=${goodsnew.id }">${goodsnew.name}</a></td>
													<td>${goodsnew.owner.name }</td>
													<td><fmt:formatDate value="${goodsnew.airTime}" pattern="yyyy-MM-dd" /></td>
												</tr>
											</c:forEach>
										</table>
									</c:when>
									<c:otherwise>
										&nbsp;&nbsp;暂无最新货品
									</c:otherwise>
								</c:choose>
                             </p>
                            
                            
                            </div>                    
                        
                        </div>
        

        </div>  
        
